<?php /* @var $this ProductController */ ?>
<?php if (Yii::app()->user->hasFlash('success')): ?>
    <div class="alert alert-success">  
        <a class="close" data-dismiss="alert">×</a>  
        <?php echo Yii::app()->user->getFlash('success') ?>
    </div>  
<?php endif ?>
<?php if (Yii::app()->user->hasFlash('error')): ?>
    <div class="alert alert-error">  
        <a class="close" data-dismiss="alert">×</a>  
        <?php echo Yii::app()->user->getFlash('error') ?>
    </div>  
<?php endif ?>
<?php $form = $this->beginWidget('CActiveForm'); ?>
<?php /* @var $form CActiveForm */?>
<div class="row">
    <div class="span12">
        <fieldset>  
            <legend>Sản phẩm</legend>  
            <div class='clearfix'>
                <label for="name">Tên sản phẩm</label>
                <div class='input'>
                    <?php echo $form->textField($model, 'title', array('size' => 80, 'maxlength' => 128)); ?>
                    <?php echo $form->error($model, 'title'); ?>
                </div>
            </div>
            <div class='clearfix'>
                <label for="address">Danh mục</label>
                <div class='input'>
                    <?php echo $form->dropDownList($model, 'category_id', CHtml::listData(Category::model()->findAll(array('order' => 'category_id ASC')), 'category_id', 'title'), array('empty' => '- Chọn một danh mục -')) ?>
                    <?php echo $form->error($model, 'category_id'); ?>
                </div>
            </div>
            <div class='clearfix'>
                <label for="address">Nhãn hiệu</label>
                <div class='input'>
                    <?php echo $form->textField($model, 'brand', array('size' => 80, 'maxlength' => 128)); ?>
                    <?php echo $form->error($model, 'brand'); ?>
                </div>
            </div>
            <div class='clearfix'>
                <label for="address">Mô tả thêm</label>
                <div class='input'>
                    <?php echo CHtml::activeTextArea($model, 'description', array('rows' => 5, 'cols' => 100, 'class' => 'span5')); ?>
                    <?php echo $form->error($model, 'description'); ?>
                </div>
            </div>
            <div class='clearfix'>
                <div class='input'>
                    <?php echo CHtml::submitButton($model->isNewRecord ? 'Nhập sản phẩm mới' : 'Lưu lại thay đổi', array('class' => 'btn btn-primary')); ?>
                    <?php echo CHtml::button('Quay về trang sản phẩm', array('class' => 'btn', 'onclick' => 'javascript:location.href = \''.$this->createUrl('list').'\'')) ?>
                </div>
            </div>

        </fieldset> 
    </div>
</div>
<?php $this->endWidget(); ?>